#include <stdio.h>
#include <string.h>
#include <stdlib.h>


#define __USE_GNU
#include <sched.h>

#include <unistd.h>
#include <pthread.h>
#include <setjmp.h>

#include <sys/syscall.h>

#define THREAD_COUNT            3


pthread_mutex_t mutex;
pthread_spinlock_t spinlock;

int inc(int *value,int add)
{
	int old;
	__asm__ volatitle(
		"lock:xaddl %2,%1;"
		: "=a"(old)
		: "m"(*valule),"a"(add)
		: "cc","memory"
	);
return old;
}

int main() {

        // 8
        int num = sysconf(_SC_NPROCESSORS_CONF);

        int i = 0;
        pid_t pid = 0;
        for (i = 0;i < num/2;i ++) {
                pid = fork();
                if (pid <= (pid_t)0) {
                        break;
                }
        }

        if (pid == 0) {
                process_affinity(num);
        }

        while (1) usleep(1);

}
